

SRC = startup_gcc.c main.c
BIN=main.bin

INCLUDE=/Users/florianzahn/Downloads/Stellaris-Launchpad
CC = ~/sat/bin/arm-none-eabi-gcc
LD = ~/sat/bin/arm-none-eabi-ld
OBJCPY=~/sat/bin/arm-none-eabi-objcopy
FLASH=~/Downloads/lm4tools/lm4flash/lm4flash
OBJ= $(SRC:.c=.o)


all: $(BIN) 

$(BIN):
	$(CC) $(SRC) -g -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Os -ffunction-sections -fdata-sections -MD -std=c99 -Wall -pedantic -DPART_LM4F120H5QR -c -I$(INCLUDE) -DTARGET_IS_BLIZZARD_RA1
	$(LD) -T main.ld --entry ResetISR -o a.out $(OBJ) --gc-sections
	$(OBJCPY) -O binary a.out $(BIN)
	
flash: $(BIN)
	 $(FLASH) $(BIN)
	 
clean:
	rm -f a.out
	rm -f *.o
	rm -f *.bin
	rm -f *.d